According to Wikipedia:
Miracast support was built into Android with version 4.2 ...
... Support was dropped again with Android 6.0 Marshmallow in 2015, in favor of Google's own Google Cast protocol.
Any answers associated with these older versions of Android do not apply.
Modern Android devices include a "cast" function, but it's Google proprietary and so cheap HDMI TV dongles might not support it, especially since it's probably a moving target, and Google wants you to buy their device.
There are apps that simply help you turn the casting function on and off, but all those do is save you from digging into the settings yourself (they don't add any casting functionality).
Is there a way to add Miracast function to a modern Android device?