Will ext4 formatted disk configured as Time Machine over SMB be recognised as Time Machine disk when directly attached?
Yes, you will have to do via the router. It could be wirelessly or via a cabled ethernet connection. This is normally not a problem as macOS Recovery supports Wi-Fi and restoring from network Time Machine backups.
If you plug the disk directly into the Mac it will not be recognized as a Time Machine disk, and you will not be able to access its contents without a third-party ext4 driver.